<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var perCount = parseInt(prompt("请输入班级人数："));
    var perScores = [];
    for (var i = 0; i < perCount; i++) {
        //成绩存入数组
        perScores[perScores.length] = parseInt(prompt("请输入第" + (i + 1) + "个学生的成绩："));
    }
    var sum = 0;
    var max = perScores[0];
    var min = perScores[0];
    for (i = 0; i < perCount; i++) {
        //总成绩
        sum += perScores[i];
        //最高分
        if (max < perScores[i]) {
            max = perScores[i];
            var every = perScores.every(function (obj) { //every  一假即假
                return obj >= 60
            })
            if(every == true) {
                console.log('全班及格了');
            } else {
                console.log('不及格');
            }
        }
        //最低分
        if (min > perScores[i]) {
            min = perScores[i];
            var some = perScores.some(function (obj) { //some  一假即假
                return obj >= 60
            })
            if(some == true) {
                console.log('同学及格了');
            } else {
                console.log('同学不及格');
            }
        }
    }
    console.log(perScores);
    console.log("总成绩：" + sum);
    console.log("平均成绩：" + sum / perCount);
    console.log("最及格：" + max);
    console.log("最不及格：" + min);


   
</script>

</html>